home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // Copyright (C) 2000 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: December 11/2000
- // Author: jdc rendering
- //
- // Description:
- //
- // This file contains the procedure which builds a popup menu for a file
- // the user has RMB clicked on in a hypergraph/visor.
- //
-
- global proc buildHypergraphFilePopupMenuItems(
- string $editor,
- string $menu,
- string $filePath)
- {
- setParent -menu $menu;
-
- string $fileNameArray[];
- tokenize($filePath, "/", $fileNameArray);
- string $fileNameTail = $fileNameArray[size($fileNameArray) - 1];
-
- string $fileTypesArray[] = `file -query -type $filePath`;
- string $fileType = $fileTypesArray[0];
-
- if ($fileType == "mayaBinary" || $fileType == "mayaAscii" || $fileType == "mayaPLE")
- {
- // The file under the cursor is a maya binary or ascii file.
- //
- menuItem
- -label ("Import Maya File " + $fileNameTail)
- -command ("file -import \"" + $filePath + "\"");
- }
- else if ($fileType == "image")
- {
- int $withPlacement;
-
- $withPlacement =
- (`optionVar -query createTexturesWithPlacement`);
-
- menuItem
- -label ("Import " + $fileNameTail )
- -annotation
- ("As Normal: Import "
- + $fileNameTail
- + " as a normal file texture")
- -command
- ("importImageFile \""
- + $filePath
- + "\" "
- + "false " // asProjection
- + "false " // asStencil
- + $withPlacement
- );
- menuItem
- -label ("Import " + $fileNameTail + " as Projection")
- -annotation
- ("As Projection: Import "
- + $fileNameTail
- + " as a projected file texture")
- -command
- ("importImageFile \""
- + $filePath
- + "\" "
- + "true " // asProjection
- + "false " // asStencil
- + $withPlacement
- );
- menuItem
- -label ("Import " + $fileNameTail + " as Stencil")
- -annotation
- ("As Stencil: Import "
- + $fileNameTail
- + " as a stencilled file texture")
- -command
- ("importImageFile \""
- + $filePath
- + "\" "
- + "false " // asProjection
- + "true " // asStencil
- + $withPlacement
- );
- menuItem -divider true;
- menuItem
- -label "Include Placement"
- -checkBox $withPlacement
- -annotation
- ("Include Placement: If on, new textures are created "
- + "with an associated placement node")
- -command
- ("optionVar -intValue createTexturesWithPlacement "
- + (!$withPlacement)
- + "; refreshCreateNodeUI();");
- menuItem -divider true;
- menuItem
- -label "Refresh Swatch"
- -annotation
- ("Refresh Swatch: Update this swatch to reflect any changes "
- + "which have been made to the file")
- -command
- ("visor -refreshSwatch \""
- + $filePath
- + "\" "
- + $editor);
- }
- else if ($fileType == "mel")
- {
- // The file under the cursor is a mel file.
- //
- menuItem
- -label ("Source " + $fileNameTail)
- -command
- ("source \""
- + $filePath
- + "\"");
- }
- else
- {
- // There is no file under the cursor, or there is a file under the
- // cursor but we do not recognize its type.
- //
- menuItem
- -label ("No options available")
- -enable false;
- }
- }
-